from PySide6.QtCore import Qt
from PySide6.QtWidgets import QWidget
from qfluentwidgets import MessageBoxBase, SubtitleLabel, LineEdit

class URLInputDialog(MessageBoxBase):
    """ URL输入对话框 """

    def __init__(self, parent=None):
        super().__init__(parent)
        self.titleLabel = SubtitleLabel('输入 URL')
        self.urlLineEdit = LineEdit()

        # 设置文本框属性
        self.urlLineEdit.setPlaceholderText('请保持视频网页肉眼可见状态')
        self.urlLineEdit.setClearButtonEnabled(True)
        
        # 将组件添加到布局中
        self.viewLayout.addWidget(self.titleLabel)
        self.viewLayout.addWidget(self.urlLineEdit)
        
        # 设置对话框的最小宽度
        self.widget.setMinimumWidth(350)
        
        # 设置确定和取消按钮的文本
        self.yesButton.setText('确定')
        self.cancelButton.setText('取消')

    def getUrl(self) -> str:
        """ 获取URL """
        return self.urlLineEdit.text() 